﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2021_5_21
{
    class Program
    {
        static void Main(string[] args)
        {
            #region NPC作业
            #region 任务NPC对象
            //送信NPC
            NPC letter = new TaskNPC(name:"Gray",taskInfo:"送信给火星的家人");
            letter.Talk();
            //杀怪NPC
            NPC Killer = new TaskNPC(name:"Killer",taskInfo:"杀掉那个哥布林村庄的所有NPC");
            Killer.Talk();
            //收集NPC
            NPC collector = new TaskNPC(name:"Collector",taskInfo:"收集那片山头的骨灰");
            collector.Talk();
            #endregion
            #region 商贩npc
            //武器商
            NPC weapon = new BussinsNPC(name:"军火商",gods:"氢弹");
            weapon.Talk();
            //材料商
            NPC material = new BussinsNPC(name: "material",gods:"反物质");
            material.Talk();
            //食物商
            NPC foods = new BussinsNPC(name:"福德",gods:"核废水");
            foods.Talk();
            #endregion
            #region 铁匠
            //强化
            NPC intensity = new Blacksmith(name:"黑色史密斯",action:action.强化);
            intensity.Talk();
            //修补
            NPC repair = new Blacksmith(name: "黑色史密斯", action: action.修补);
            repair.Talk();
            //铸造
            NPC create = new Blacksmith(name: "黑色史密斯", action: action.打造);
            create.Talk();
            #endregion
            #endregion
            #region 机器人
            Console.ForegroundColor = ConsoleColor.Yellow;

            Robot robot = new DeliveryBot();
            for (int i = 0; i < 1; i++)
            {
                Console.WriteLine("请选择机器人的功能【传菜】【炒菜】");
                string action = Console.ReadLine();
                if (action.Equals("传菜") || action.Equals("炒菜"))
                {
                  robot = ChooseRobot(action, robot);
                }
                else 
                {
                    action = "null";
                    i--;
                }
            }
            robot.Wroking();

           
            #endregion
        }

        #region 在主类中定义一个方法
        //形参数据类型是string，
        //返回值数据类型是Robot，
        //方法中实现如果传入的字符串是“炒菜”，
        //那就返回CookRobot的实例（当然是要用Robot的引用指向的），如果传入的字符串是“传菜”，那就返回DeliveryRobot的实例。
        public static Robot ChooseRobot(String action , Robot robot)
        {
            if (action.Equals("传菜"))
            {
                return robot = new DeliveryBot();
            }
            else if (action.Equals("炒菜"))
            {

                return robot = new CookRobot();
                
            }
            return robot = new DeliveryBot();
        }
        #endregion
    }
}
